<template>
	<div class="nineflex">
		<ul>
			<li  @click="toUrl(menu.name)" v-for="menu in menuList">
				<img v-bind:src="menu.img">
				<span>{{menu.text}}</span>
			</li>
			
			<li>
			    <a  :href='WEBROOT+"csp/csp.html#/riskRatingList?empNo="+$route.query.empNo'>
			    	<img :src="require('../../assets/img/assessmentActivity.png')">
					<span>活动风险评估</span>
				</a>
				
			</li>
		</ul>
		<toast v-if="toastShow" :message="tipMessage"></toast>
	</div>
</template>

<script type="text/javascript">

	import SafeStyle from '../../assets/css/safe.scss'

	import safeUrl, { WEBROOT } from '../../assets/js/insterface'

	import getQuery from '../../assets/js/get_querys'

	import http from '../../assets/js/http_mixin'

	export default {
		data () {
			return {
				WEBROOT: WEBROOT,
				personalId:'',
				tipMessage:'',
				menuList : [
					{
						id:'1',
						img: require('../../assets/img/NM.png'),
						name: 'NM',
						text: 'Near Miss'
					},{
						id: '2',
						img: require('../../assets/img/Safe2go.jpg'),
						name: 'STG',
						text: 'SAFE TO GO'
					},{
						id: '3',
						img: require('../../assets/img/SOC1.png'),
						name: 'SOC',
						text: 'SOC'
					},{
						id: '4',
						img: require('../../assets/img/RA.png'),
						name: 'RA',
						text: 'Ride Along'
					},{
						id: '5',
						img: require('../../assets/img/MEETING.png'),
						name: 'SafeMeet',
						text: '会议纪要'
					},{
						id: '6',
						img: require('../../assets/img/ACCIDENT.png'),
						name: 'accident',
						text: '事故报告'
					},{
						id: '7',
						img: require('../../assets/img/car.jpg'),
						name: 'VEHICLE',
						text: '季度车检'
					},{
						id: '8',
						img: require('../../assets/img/jra.jpg'),
						name: 'JRA',
						text: '道路风险评估'
					}
					// ,{
					// 	id: '9',
					// 	img: '',
					// 	name: '',
					// 	text: ''
					// }
				]
			}
		},

		mixins:[getQuery, http],

		mounted(){
			document.title="安全报告";
			var query = this.getQuerys();
      		this.personalId = query.empNo;
      		console.log('ssssssssssssssss'+WEBROOT)
		},
		methods:{
			toUrl(urlName){
				var vue = this;
				if(urlName == 'accident' || urlName == 'VEHICLE'){
					this.$http.post(safeUrl.checkBindCar,{empNo:this.personalId},{emulateJSON: true})
					.then((response) =>{
						if(response.data.type == "2"){
							this.$router.push({path:'/SafeMenu/' + urlName,query:{empNo:this.personalId}});
						}else{
							this.toastShow = true;
				            this.tipMessage = response.data.msg;
				            setTimeout(function(){
				                vue.toastShow = false;
				            },1500);
				            return ;
						}
						// debugger;
						console.log(response.data)
					})
					.then(function(response){
						console.log(response)
					})
				}else{
					this.$router.push({path:'/SafeMenu/' + urlName,query:{empNo:this.personalId}});
				}
				
			}
		}


	}

</script>
